<?php namespace Summer\Shop\Updates;

use Schema;
use Winter\Storm\Database\Updates\Migration;

class BuilderTableCreateSummerShopOrders extends Migration
{
    public function up()
    {
        Schema::create('summer_shop_orders', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->timestamp('created_at')->nullable();
            $table->timestamp('updated_at')->nullable();
            $table->string('order_sn');
            $table->integer('user_id');
            $table->text('user_address');
            $table->decimal('total', 14, 2)->default(0.00);
            $table->decimal('coupon_fee', 14, 2)->nullable()->default(0.00);
            $table->decimal('discount_fee', 14, 2)->nullable()->default(0.00);
            $table->decimal('goods_amount', 14, 2)->nullable()->default(0.00);
            $table->decimal('invoice_amount', 14, 2)->nullable()->default(0.00);
            $table->decimal('dispatch_amount', 14, 2)->nullable()->default(0.00);
            $table->decimal('dispatch_discount_money', 14, 2)->nullable()->default(0.00);
            $table->smallInteger('is_pay')->nullable()->default(0);
            $table->dateTime('pay_at')->nullable();
            $table->integer('status')->nullable()->default(0);
            $table->string('status_slug')->nullable();
            $table->dateTime('deliver_at')->nullable();
            $table->dateTime('complete_at')->nullable();
            $table->string('express_slug')->nullable();
            $table->string('express_name')->nullable();
            $table->string('express_no')->nullable();
            $table->integer('is_comment')->nullable();
            $table->string('remark')->nullable();

        });
    }
    
    public function down()
    {
        Schema::dropIfExists('summer_shop_orders');
    }
}
